
import { setProductPrice } from '~/common'
export const COLUMNS_PRODUCT = [
  {
    width: '150',
    prop: 'productCode',
    label: '产品编码'
  },
  {
    width: '200',
    prop: 'productName',
    label: '产品名称（中）',
    'show-overflow-tooltip': true
  },
  {
    width: '150',
    prop: 'attribute5',
    label: '条形码'
  },
  {
    width: '100',
    prop: 'productUnitName',
    label: '单位'
  },
  {
    width: '150',
    prop: 'productLineName',
    label: '产品线'
  },
  {
    'min-width': '100',
    prop: 'attribute1',
    label: '规格',
    'show-overflow-tooltip': true
  },
  {
    'min-width': '100',
    prop: 'attribute1',
    label: '型号',
    'show-overflow-tooltip': true
  },
  { width: '150', prop: 'productCount', label: '采购数量' },
  {
    'min-width': '100',
    prop: 'referencePrice',
    label: '参考单价（元）',
    formatter: row => setProductPrice(row.referencePrice)
  },
  { width: '60', prop: 'opt', label: '操作' }
];
export const SALESORDER_COLUMNS_PRODUCT = [
  { width: '60', prop: 'index', label: '序号' },
  {
    width: '150',
    prop: 'originalFactoryProductCode',
    label: '原厂产品编码',
    'show-overflow-tooltip': true
  },
  {
    width: '200',
    prop: 'productCode',
    label: '供应商产品编码',
    'show-overflow-tooltip': true
  },
  {
    width: '200',
    prop: 'productName',
    label: '产品名称',
    'show-overflow-tooltip': true
  },
  {
    width: '150',
    prop: 'model',
    label: '规格',
    'show-overflow-tooltip': true
  }, //0
  {
    width: '150',
    prop: 'model',
    label: '型号',
    'show-overflow-tooltip': true
  }, //0
  {
    width: '100',
    prop: 'productUnitName',
    label: '单位'
  }, 
  {
    width: '200',
    prop: 'manufacturerName',
    label: '生产厂家',
    'show-overflow-tooltip': true
  },
 
  {
    width: '140',
    prop: 'productLineName',
    label: '产品线'
  }, //0
  {
    width: '140',
    prop: 'batchNo',
    label: '批号',
    'show-overflow-tooltip': true
  },
  {
    width: '140',
    prop: 'manufactureDate',
    label: '生产日期',
    'show-overflow-tooltip': true
  },
  {
    width: '180',
    prop: 'validDate',
    label: '有效期',
    'show-overflow-tooltip': true
  },
  {
    width: '350',
    prop: 'productCount',
    label: '销售数量'
  },
  {
    width: '280',
    prop: 'hospName',
    label: '销售医院'
  },
  {
    width: '140',
    prop: 'productPrice',
    label: '单价（元）',
    formatter: row => {
      let price = row.productPrice
      if (row.productPrice !== '待定') {
        price = (Math.floor(row.productPrice * 100)/100)
        if (Number.isInteger(price)) {
          price = price.toString() + '.00'
        }
      }
      if (row.productPrice === null || row.productPrice === '' || row.productPrice === undefined) {
        price = '待定'
      }
      return price
    },
    'show-overflow-tooltip': true
  },
  {
    width: '140',
    prop: 'priceCount',
    label: '金额小计（元）',
    'show-overflow-tooltip': true,
    formatter: row => setProductPrice(row.priceCount)
  },
  {
    width: '140',
    prop: 'opt',
    label: '操作'
  }
];
export const GIFT_FLAG = {
  1: '否',
  2: '是',
}
export const  DETAIL_COlUMNS = [
  {
    prop: '',
    label: '序列号',
    'show-overflow-tooltip': true
  },
  {
    prop: '',
    label: '原厂产品编码',
    'show-overflow-tooltip': true
  },
  {
    prop: '',
    label: '供应商产品编码',
    'show-overflow-tooltip': true
  },
  {
    prop: '',
    label: '产品名称',
    'show-overflow-tooltip': true
  },
  {
    prop: '',
    label: '批号',
    'show-overflow-tooltip': true
  },
  { width: '60', prop: 'opt', label: '操作' }
];
